package com.controller.generic_controller;

import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.GetMapping;

import javax.servlet.http.HttpServletRequest;

/**
 * go控制器
 * 跳转控制器
 *
 * @author admin
 * 2023/06/19
 * @date 2023/07/02 19:22:08
 */
@Controller
public class goController {

    /**
     * 购物车
     *
     * @return {@link String}
     */
    @GetMapping("goCart")
    public String goCart() {
        return "cart";
    }

    /**
     * 去结账
     *
     * @return {@link String}
     */
    @GetMapping("goCheckout")
    public String goCheckout() {
        return "checkout";
    }
    @GetMapping("goMyAccount")
    public String goMyAccount() {
        return "my-account";
    }
    @GetMapping("goTracking")
    public String goTracking() {
        return "order-tracking";
    }
    @GetMapping("goFace")
    public String goFace() {
        return "face";
    }
    @GetMapping("goClockInForClass")
    public String goClockInForClass() {
        return "ClockInForClass";
    }@GetMapping("remove")
    public String goIndex(HttpServletRequest request) {
        request.getSession().removeAttribute("consumer");
        request.getSession().removeAttribute("password");
        request.getSession().removeAttribute("consumerPassword");
        request.getSession().getServletContext().removeAttribute(request.getSession().getId());
        request.getSession().removeAttribute("consumerPassword");
        request.getSession().removeAttribute(request.getSession().getId());
        return "redirect:/index.jsp";
    }

}
